package com.elai.baseconfig.service.impl;

import java.util.List;
import com.elai.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.elai.baseconfig.mapper.BaseBlackListMapper;
import com.elai.baseconfig.domain.BaseBlackListDO;
import com.elai.baseconfig.service.BaseBlackListService;

/**
 * 黑名单Service业务层处理
 *
 * @author elai
 * @date 2021-07-18
 */
@Service
public class BaseBlackListServiceImpl implements BaseBlackListService
{
    @Autowired
    private BaseBlackListMapper baseBlackListMapper;

    /**
     * 查询黑名单
     *
     * @param id 黑名单ID
     * @return 黑名单
     */
    @Override
    public BaseBlackListDO selectBaseBlackListById(Long id)
    {
        return baseBlackListMapper.selectBaseBlackListById(id);
    }

    /**
     * 查询黑名单列表
     *
     * @param baseBlackList 黑名单
     * @return 黑名单
     */
    @Override
    public List<BaseBlackListDO> selectBaseBlackListList(BaseBlackListDO baseBlackList)
    {
        return baseBlackListMapper.selectBaseBlackListList(baseBlackList);
    }

    /**
     * 新增黑名单
     *
     * @param baseBlackList 黑名单
     * @return 结果
     */
    @Override
    public int insertBaseBlackList(BaseBlackListDO baseBlackList)
    {
        baseBlackList.setCreateTime(DateUtils.getNowDate());
    baseBlackList.setUpdateTime(DateUtils.getNowDate());
        return baseBlackListMapper.insertBaseBlackList(baseBlackList);
    }

    /**
     * 修改黑名单
     *
     * @param baseBlackList 黑名单
     * @return 结果
     */
    @Override
    public int updateBaseBlackList(BaseBlackListDO baseBlackList)
    {
        baseBlackList.setUpdateTime(DateUtils.getNowDate());
        return baseBlackListMapper.updateBaseBlackList(baseBlackList);
    }

    /**
     * 批量删除黑名单
     *
     * @param ids 需要删除的黑名单ID
     * @return 结果
     */
    @Override
    public int deleteBaseBlackListByIds(Long[] ids)
    {
        return baseBlackListMapper.deleteBaseBlackListByIds(ids);
    }

    /**
     * 删除黑名单信息
     *
     * @param id 黑名单ID
     * @return 结果
     */
    @Override
    public int deleteBaseBlackListById(Long id)
    {
        return baseBlackListMapper.deleteBaseBlackListById(id);
    }
}
